home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / GXMath.a < prev    next >
Text File  |  1996-05-01  |  11KB  |  581 lines

  1. ;
  2. ;    File:        GXMath.a
  3. ;
  4. ;    Contains:    QuickDraw GX math routine interfaces.
  5. ;
  6. ;    Version:    Technology:    Quickdraw GX 1.1
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__GXMATH__') = 'UNDEFINED' THEN
  19. __GXMATH__ SET 1
  20.  
  21.     IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
  22.     include 'ConditionalMacros.a'
  23.     ENDIF
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27.     IF &TYPE('__FIXMATH__') = 'UNDEFINED' THEN
  28.     include 'FixMath.a'
  29.     ENDIF
  30. gxPoint                    RECORD 0
  31. x                         ds.l    1                ; offset: $0 (0)
  32. y                         ds.l    1                ; offset: $4 (4)
  33. sizeof                     EQU *                    ; size:   $8 (8)
  34.                         ENDR
  35. ; typedef unsigned short                 gxColorValue
  36.  
  37. gxPolar                    RECORD 0
  38. radius                     ds.l    1                ; offset: $0 (0)
  39. angle                     ds.l    1                ; offset: $4 (4)
  40. sizeof                     EQU *                    ; size:   $8 (8)
  41.                         ENDR
  42. gxMapping                RECORD 0
  43. map                         ds.l    3 * 3            ; offset: $0 (0)
  44. sizeof                     EQU *                    ; size:   $24 (36)
  45.                         ENDR
  46.  
  47. gxColorValue1                    EQU        $0000FFFF            ; gxColorValue 1.0 
  48.  
  49. gxPositiveInfinity                EQU        $7FFFFFFF            ; for Fixed and Fract 
  50. gxNegativeInfinity                EQU        $80000000            ; for Fixed and Fract 
  51.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  52. ;
  53. ; extern gxMapping *CopyToMapping(gxMapping *target, const gxMapping *source)
  54. ;
  55.     IF ¨ GENERATINGCFM THEN
  56.         Macro
  57.         _CopyToMapping
  58.             move.w              #$0031,D0
  59.             dc.w                $A832
  60.         EndM
  61.     ELSE
  62.         IMPORT_CFM_FUNCTION CopyToMapping
  63.     ENDIF
  64.  
  65. ;
  66. ; extern gxMapping *InvertMapping(gxMapping *target, const gxMapping *source)
  67. ;
  68.     IF ¨ GENERATINGCFM THEN
  69.         Macro
  70.         _InvertMapping
  71.             move.w              #$0032,D0
  72.             dc.w                $A832
  73.         EndM
  74.     ELSE
  75.         IMPORT_CFM_FUNCTION InvertMapping
  76.     ENDIF
  77.  
  78. ;
  79. ; extern gxMapping *MapMapping(gxMapping *target, const gxMapping *source)
  80. ;
  81.     IF ¨ GENERATINGCFM THEN
  82.         Macro
  83.         _MapMapping
  84.             move.w              #$0033,D0
  85.             dc.w                $A832
  86.         EndM
  87.     ELSE
  88.         IMPORT_CFM_FUNCTION MapMapping
  89.     ENDIF
  90.  
  91. ;
  92. ; extern gxMapping *MoveMapping(gxMapping *target, Fixed hOffset, Fixed vOffset)
  93. ;
  94.     IF ¨ GENERATINGCFM THEN
  95.         Macro
  96.         _MoveMapping
  97.             move.w              #$0034,D0
  98.             dc.w                $A832
  99.         EndM
  100.     ELSE
  101.         IMPORT_CFM_FUNCTION MoveMapping
  102.     ENDIF
  103.  
  104. ;
  105. ; extern gxMapping *MoveMappingTo(gxMapping *target, Fixed hPosition, Fixed vPosition)
  106. ;
  107.     IF ¨ GENERATINGCFM THEN
  108.         Macro
  109.         _MoveMappingTo
  110.             move.w              #$0035,D0
  111.             dc.w                $A832
  112.         EndM
  113.     ELSE
  114.         IMPORT_CFM_FUNCTION MoveMappingTo
  115.     ENDIF
  116.  
  117. ;
  118. ; extern gxMapping *NormalizeMapping(gxMapping *target)
  119. ;
  120.     IF ¨ GENERATINGCFM THEN
  121.         Macro
  122.         _NormalizeMapping
  123.             move.w              #$0036,D0
  124.             dc.w                $A832
  125.         EndM
  126.     ELSE
  127.         IMPORT_CFM_FUNCTION NormalizeMapping
  128.     ENDIF
  129.  
  130. ;
  131. ; extern gxMapping *RotateMapping(gxMapping *target, Fixed angle, Fixed xCenter, Fixed yCenter)
  132. ;
  133.     IF ¨ GENERATINGCFM THEN
  134.         Macro
  135.         _RotateMapping
  136.             move.w              #$0037,D0
  137.             dc.w                $A832
  138.         EndM
  139.     ELSE
  140.         IMPORT_CFM_FUNCTION RotateMapping
  141.     ENDIF
  142.  
  143. ;
  144. ; extern gxMapping *ScaleMapping(gxMapping *target, Fixed hFactor, Fixed vFactor, Fixed xCenter, Fixed yCenter)
  145. ;
  146.     IF ¨ GENERATINGCFM THEN
  147.         Macro
  148.         _ScaleMapping
  149.             move.w              #$0038,D0
  150.             dc.w                $A832
  151.         EndM
  152.     ELSE
  153.         IMPORT_CFM_FUNCTION ScaleMapping
  154.     ENDIF
  155.  
  156. ;
  157. ; extern gxMapping *ResetMapping(gxMapping *target)
  158. ;
  159.     IF ¨ GENERATINGCFM THEN
  160.         Macro
  161.         _ResetMapping
  162.             move.w              #$0039,D0
  163.             dc.w                $A832
  164.         EndM
  165.     ELSE
  166.         IMPORT_CFM_FUNCTION ResetMapping
  167.     ENDIF
  168.  
  169. ;
  170. ; extern gxMapping *SkewMapping(gxMapping *target, Fixed skewX, Fixed skewY, Fixed xCenter, Fixed yCenter)
  171. ;
  172.     IF ¨ GENERATINGCFM THEN
  173.         Macro
  174.         _SkewMapping
  175.             move.w              #$003A,D0
  176.             dc.w                $A832
  177.         EndM
  178.     ELSE
  179.         IMPORT_CFM_FUNCTION SkewMapping
  180.     ENDIF
  181.  
  182. ;
  183. ; extern void MapPoints(const gxMapping *source, long count, gxPoint vector[2147483647])
  184. ;
  185.     IF ¨ GENERATINGCFM THEN
  186.         Macro
  187.         _MapPoints
  188.             move.w              #$003B,D0
  189.             dc.w                $A832
  190.         EndM
  191.     ELSE
  192.         IMPORT_CFM_FUNCTION MapPoints
  193.     ENDIF
  194.  
  195. ;
  196. ; extern short FirstBit(unsigned long x)
  197. ;
  198.     IF ¨ GENERATINGCFM THEN
  199.         Macro
  200.         _FirstBit
  201.             move.w              #$003C,D0
  202.             dc.w                $A832
  203.         EndM
  204.     ELSE
  205.         IMPORT_CFM_FUNCTION FirstBit
  206.     ENDIF
  207.  
  208. ;
  209. ; extern short WideScale(const wide *source)
  210. ;
  211.     IF ¨ GENERATINGCFM THEN
  212.         Macro
  213.         _WideScale
  214.             move.w              #$003D,D0
  215.             dc.w                $A832
  216.         EndM
  217.     ELSE
  218.         IMPORT_CFM_FUNCTION WideScale
  219.     ENDIF
  220.  
  221. ;
  222. ; extern short LinearRoot(Fixed first, Fixed last, Fract t[2147483647])
  223. ;
  224.     IF ¨ GENERATINGCFM THEN
  225.         Macro
  226.         _LinearRoot
  227.             move.w              #$003E,D0
  228.             dc.w                $A832
  229.         EndM
  230.     ELSE
  231.         IMPORT_CFM_FUNCTION LinearRoot
  232.     ENDIF
  233.  
  234. ;
  235. ; extern short QuadraticRoot(Fixed first, Fixed control, Fixed last, Fract t[2147483647])
  236. ;
  237.     IF ¨ GENERATINGCFM THEN
  238.         Macro
  239.         _QuadraticRoot
  240.             move.w              #$003F,D0
  241.             dc.w                $A832
  242.         EndM
  243.     ELSE
  244.         IMPORT_CFM_FUNCTION QuadraticRoot
  245.     ENDIF
  246.  
  247. ;
  248. ; extern gxPoint *PolarToPoint(const gxPolar *ra, gxPoint *xy)
  249. ;
  250.     IF ¨ GENERATINGCFM THEN
  251.         Macro
  252.         _PolarToPoint
  253.             move.w              #$0040,D0
  254.             dc.w                $A832
  255.         EndM
  256.     ELSE
  257.         IMPORT_CFM_FUNCTION PolarToPoint
  258.     ENDIF
  259.  
  260. ;
  261. ; extern gxPolar *PointToPolar(const gxPoint *xy, gxPolar *ra)
  262. ;
  263.     IF ¨ GENERATINGCFM THEN
  264.         Macro
  265.         _PointToPolar
  266.             move.w              #$0041,D0
  267.             dc.w                $A832
  268.         EndM
  269.     ELSE
  270.         IMPORT_CFM_FUNCTION PointToPolar
  271.     ENDIF
  272.  
  273. ;
  274. ; extern Fract FractCubeRoot(Fract source)
  275. ;
  276.     IF ¨ GENERATINGCFM THEN
  277.         Macro
  278.         _FractCubeRoot
  279.             move.w              #$0042,D0
  280.             dc.w                $A832
  281.         EndM
  282.     ELSE
  283.         IMPORT_CFM_FUNCTION FractCubeRoot
  284.     ENDIF
  285.  
  286. ;
  287. ; extern Fract FractDivide(Fract dividend, Fract divisor)
  288. ;
  289.     IF ¨ GENERATINGCFM THEN
  290.         Macro
  291.         _FractDivide
  292.             move.w              #$0043,D0
  293.             dc.w                $A832
  294.         EndM
  295.     ELSE
  296.         IMPORT_CFM_FUNCTION FractDivide
  297.     ENDIF
  298.  
  299. ;
  300. ; extern Fract FractMultiply(Fract multiplicand, Fract multiplier)
  301. ;
  302.     IF ¨ GENERATINGCFM THEN
  303.         Macro
  304.         _FractMultiply
  305.             move.w              #$0044,D0
  306.             dc.w                $A832
  307.         EndM
  308.     ELSE
  309.         IMPORT_CFM_FUNCTION FractMultiply
  310.     ENDIF
  311.  
  312. ;
  313. ; extern Fract FractSineCosine(Fixed degrees, Fract *cosine)
  314. ;
  315.     IF ¨ GENERATINGCFM THEN
  316.         Macro
  317.         _FractSineCosine
  318.             move.w              #$0045,D0
  319.             dc.w                $A832
  320.         EndM
  321.     ELSE
  322.         IMPORT_CFM_FUNCTION FractSineCosine
  323.     ENDIF
  324.  
  325. ;
  326. ; extern Fract FractSquareRoot(Fract source)
  327. ;
  328.     IF ¨ GENERATINGCFM THEN
  329.         Macro
  330.         _FractSquareRoot
  331.             move.w              #$0046,D0
  332.             dc.w                $A832
  333.         EndM
  334.     ELSE
  335.         IMPORT_CFM_FUNCTION FractSquareRoot
  336.     ENDIF
  337.  
  338. ;
  339. ; extern Fixed FixedDivide(Fixed dividend, Fixed divisor)
  340. ;
  341.     IF ¨ GENERATINGCFM THEN
  342.         Macro
  343.         _FixedDivide
  344.             move.w              #$0047,D0
  345.             dc.w                $A832
  346.         EndM
  347.     ELSE
  348.         IMPORT_CFM_FUNCTION FixedDivide
  349.     ENDIF
  350.  
  351. ;
  352. ; extern Fixed FixedMultiply(Fixed multiplicand, Fixed multiplier)
  353. ;
  354.     IF ¨ GENERATINGCFM THEN
  355.         Macro
  356.         _FixedMultiply
  357.             move.w              #$0048,D0
  358.             dc.w                $A832
  359.         EndM
  360.     ELSE
  361.         IMPORT_CFM_FUNCTION FixedMultiply
  362.     ENDIF
  363.  
  364. ;  This next call is (source * multiplier / divisor) -- it avoids underflow, overflow by using wides 
  365. ;
  366. ; extern long MultiplyDivide(long source, long multiplier, long divisor)
  367. ;
  368.     IF ¨ GENERATINGCFM THEN
  369.         Macro
  370.         _MultiplyDivide
  371.             move.w              #$0049,D0
  372.             dc.w                $A832
  373.         EndM
  374.     ELSE
  375.         IMPORT_CFM_FUNCTION MultiplyDivide
  376.     ENDIF
  377.  
  378. ;
  379. ; extern unsigned long Magnitude(long deltaX, long deltaY)
  380. ;
  381.     IF ¨ GENERATINGCFM THEN
  382.         Macro
  383.         _Magnitude
  384.             move.w              #$004A,D0
  385.             dc.w                $A832
  386.         EndM
  387.     ELSE
  388.         IMPORT_CFM_FUNCTION Magnitude
  389.     ENDIF
  390.  
  391. ;
  392. ; extern long VectorMultiplyDivide(long count, const long *vector1, long step1, const long *vector2, long step2, long divisor)
  393. ;
  394.     IF ¨ GENERATINGCFM THEN
  395.         Macro
  396.         _VectorMultiplyDivide
  397.             move.w              #$004B,D0
  398.             dc.w                $A832
  399.         EndM
  400.     ELSE
  401.         IMPORT_CFM_FUNCTION VectorMultiplyDivide
  402.     ENDIF
  403.  
  404. ;  wide operations are defined within FixMath.h only for PowerPC 
  405.     IF ¨ GENERATINGPOWERPC THEN
  406. ;
  407. ; extern wide *WideAdd(wide *target, const wide *source)
  408. ;
  409.     IF ¨ GENERATINGCFM THEN
  410.         Macro
  411.         _WideAdd
  412.             move.w              #$004C,D0
  413.             dc.w                $A832
  414.         EndM
  415.     ELSE
  416.         IMPORT_CFM_FUNCTION WideAdd
  417.     ENDIF
  418.  
  419. ;
  420. ; extern short WideCompare(const wide *target, const wide *source)
  421. ;
  422.     IF ¨ GENERATINGCFM THEN
  423.         Macro
  424.         _WideCompare
  425.             move.w              #$004D,D0
  426.             dc.w                $A832
  427.         EndM
  428.     ELSE
  429.         IMPORT_CFM_FUNCTION WideCompare
  430.     ENDIF
  431.  
  432. ;
  433. ; extern wide *WideNegate(wide *target)
  434. ;
  435.     IF ¨ GENERATINGCFM THEN
  436.         Macro
  437.         _WideNegate
  438.             move.w              #$004E,D0
  439.             dc.w                $A832
  440.         EndM
  441.     ELSE
  442.         IMPORT_CFM_FUNCTION WideNegate
  443.     ENDIF
  444.  
  445. ;
  446. ; extern wide *WideShift(wide *target, long shift)
  447. ;
  448.     IF ¨ GENERATINGCFM THEN
  449.         Macro
  450.         _WideShift
  451.             move.w              #$004F,D0
  452.             dc.w                $A832
  453.         EndM
  454.     ELSE
  455.         IMPORT_CFM_FUNCTION WideShift
  456.     ENDIF
  457.  
  458. ;
  459. ; extern unsigned long WideSquareRoot(const wide *source)
  460. ;
  461.     IF ¨ GENERATINGCFM THEN
  462.         Macro
  463.         _WideSquareRoot
  464.             move.w              #$0050,D0
  465.             dc.w                $A832
  466.         EndM
  467.     ELSE
  468.         IMPORT_CFM_FUNCTION WideSquareRoot
  469.     ENDIF
  470.  
  471. ;
  472. ; extern wide *WideSubtract(wide *target, const wide *source)
  473. ;
  474.     IF ¨ GENERATINGCFM THEN
  475.         Macro
  476.         _WideSubtract
  477.             move.w              #$0051,D0
  478.             dc.w                $A832
  479.         EndM
  480.     ELSE
  481.         IMPORT_CFM_FUNCTION WideSubtract
  482.     ENDIF
  483.  
  484. ;
  485. ; extern wide *WideMultiply(long multiplicand, long multiplier, wide *target)
  486. ;
  487.     IF ¨ GENERATINGCFM THEN
  488.         Macro
  489.         _WideMultiply
  490.             move.w              #$0052,D0
  491.             dc.w                $A832
  492.         EndM
  493.     ELSE
  494.         IMPORT_CFM_FUNCTION WideMultiply
  495.     ENDIF
  496.  
  497. ;  returns the quotient 
  498. ;
  499. ; extern long WideDivide(const wide *dividend, long divisor, long *remainder)
  500. ;
  501.     IF ¨ GENERATINGCFM THEN
  502.         Macro
  503.         _WideDivide
  504.             move.w              #$0053,D0
  505.             dc.w                $A832
  506.         EndM
  507.     ELSE
  508.         IMPORT_CFM_FUNCTION WideDivide
  509.     ENDIF
  510.  
  511. ;  quotient replaces dividend 
  512. ;
  513. ; extern wide *WideWideDivide(wide *dividend, long divisor, long *remainder)
  514. ;
  515.     IF ¨ GENERATINGCFM THEN
  516.         Macro
  517.         _WideWideDivide
  518.             move.w              #$0055,D0
  519.             dc.w                $A832
  520.         EndM
  521.     ELSE
  522.         IMPORT_CFM_FUNCTION WideWideDivide
  523.     ENDIF
  524.  
  525.     ENDIF
  526. ;
  527. ; extern wide *VectorMultiply(long count, const long *vector1, long step1, const long *vector2, long step2, wide *dot)
  528. ;
  529.     IF ¨ GENERATINGCFM THEN
  530.         Macro
  531.         _VectorMultiply
  532.             move.w              #$0054,D0
  533.             dc.w                $A832
  534.         EndM
  535.     ELSE
  536.         IMPORT_CFM_FUNCTION VectorMultiply
  537.     ENDIF
  538.  
  539. ;
  540. ; extern unsigned long RandomBits(long count, long focus)
  541. ;
  542.     IF ¨ GENERATINGCFM THEN
  543.         Macro
  544.         _RandomBits
  545.             move.w              #$0056,D0
  546.             dc.w                $A832
  547.         EndM
  548.     ELSE
  549.         IMPORT_CFM_FUNCTION RandomBits
  550.     ENDIF
  551.  
  552. ;
  553. ; extern void SetRandomSeed(const wide *seed)
  554. ;
  555.     IF ¨ GENERATINGCFM THEN
  556.         Macro
  557.         _SetRandomSeed
  558.             move.w              #$0057,D0
  559.             dc.w                $A832
  560.         EndM
  561.     ELSE
  562.         IMPORT_CFM_FUNCTION SetRandomSeed
  563.     ENDIF
  564.  
  565. ;
  566. ; extern wide *GetRandomSeed(wide *seed)
  567. ;
  568.     IF ¨ GENERATINGCFM THEN
  569.         Macro
  570.         _GetRandomSeed
  571.             move.w              #$0058,D0
  572.             dc.w                $A832
  573.         EndM
  574.     ELSE
  575.         IMPORT_CFM_FUNCTION GetRandomSeed
  576.     ENDIF
  577.  
  578.     ENDIF
  579.     ENDIF ; __GXMATH__ 
  580.  
  581.